<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ include file="../../common/taglibs.jsp"%>
<%@include file="../common/header_easyui.jsp" %>
<script language="javascript">
    $(document).ready(function () {
        jQuery("#projectGrid").jqGrid({
            url:'${ctx}/project/hisGrid.do',
            datatype: "json",
            colNames:["ID","项目名称","项目编号","项目类型","原稿名称","原语言","目标语言","翻译字数","开始时间","结束时间","操作"],
            colModel:[
                {name:'id',index:'id',width:80,align:"center",sortable:false,hidden:true},
                {name:'name',index:'name',width:80,align:"center",sortable:false},
                {name:'code',index:'code',width:80,align:"center",sortable:false},
                {name:'type.name',index:'type.name',width:80,align:"center",sortable:false},
                {name:'sourceName',index:'sourceName',width:80,align:"center",sortable:false},
                {name:'souceLanguage.name',index:'souceLanguage.name',width:80,align:"center",sortable:false},
                {name:'targetLanguage.name',index:'targetLanguage.name',width:80,align:"center",sortable:false},
                {name:'wordCount',index:'wordCount',width:80,align:"center",sortable:false},
                {name:'startDate',index:'startDate',width:80,align:"center",sortable:false},
                {name:'endDate',index:'endDate',width:80,align:"center",sortable:false},
                {name:'operation',index:'Id',width:80,align:"center",sortable:false}
            ],
            rowNum:15,
            autowidth :true, // 宽度自适应父窗口宽度
            mtype:"POST", // POST GET
            prmNames:{rows:"pageSize", sort:"orderBy", order:"order"}, // 设置翻页、排序参数
            rowList:[15,30,50],
            pager: '#pageProjectGrid',
            jsonReader: { repeatitems : false },
            shrinkToFit: true,
//            caption: "项目列表",
//            multiselect: true,
            rownumbers:true,
            height: 330,
            gridComplete:function(){  //在此事件中循环为每一行添加修改和删除链接
                var ids=jQuery("#projectGrid").jqGrid('getDataIDs');
                for(var i=0; i<ids.length; i++){
                    var id=ids[i];
                    var operation = "<a href='#' style='color:#f60' onclick='doView(" + id + ")'>查看</a>&nbsp;";
//                    operation = "<a href='#' style='color:#f60' onclick='doEdit(" + id + ")'>修改</a>";  //这里的onclick就是调用了上面的javascript函数 Modify(id)
//                    operation += "&nbsp;<a href='#'  style='color:#f60' onclick='doDelete(" + id + ")' >删除</a>";
                    jQuery("#projectGrid").jqGrid('setRowData', ids[i], { operation: operation});
                }
            }
        });

        jQuery("#projectGrid").jqGrid('navGrid','#pageProjectGrid',{edit:false,add:false,del:false,search:false});

        setGridWidth = function (width){
            jQuery("#projectGrid").setGridWidth(width, true);
        };

//        JORegion.showAll();

        /**
         * 进行校核绑定
         */
        $('#projectForm input').each(function () {
            if ($(this).attr('required') || $(this).attr('validType')) {
                $(this).validatebox();
            }
        });
    });


    function doView(id) {
        openWindow("projectWindow", "查看", "${ctx}/project/view.do?id=" + id, true, "projectGrid",800,430);
    }

</script>

<body class="easyui-layout" style="overflow-y: hidden" scroll="no">
<div region="center" title="项目列表" style="width:100%; height:100%; background:#fafafa;overflow-x: hidden; overflow-y: auto;">
    <%--<div id="jo_region_001" title="查询条件" divId="effect1" style="width: 100%">--%>
    <div id="effect1">
        <form id="projectForm" action="">
            <table width="100%">
                <tr>
                    <td width="8%" nowrap="nowrap" align="left">
                        项目编码:
                        <input type="text" id="code" name="code" value="" class="title_input"
                               op="like" entity="t" isCapital="false" dtype="String"/>
                    </td>
                    <td width="8%" nowrap="nowrap" align="left">
                        项目名称:
                        <input type="text" id="name" name="name" value="" class="title_input"
                               op="like" entity="t" isCapital="false" dtype="String"/>
                    </td>
                    <td width="8%" nowrap="nowrap" align="left">
                        项目类型:
                        <input type="text"
                               class="easyui-combobox"
                               id="type"
                               name="type"
                               url="${ctx}/sysCode/getCodeDetailList.do?code=PROJECT_TYPE"
                               valueField="id"
                               textField="name"
                               entity="t"
                               op="eq"
                               panelHeight="auto"
                               value="${bean.type.id}"/>&nbsp;
                    </td>
                    <td width="8%" nowrap="nowrap" align="left">
                        原稿名称:
                        <input type="text" id="sourceName" name="sourceName" value="" class="title_input"
                               op="like" entity="t" isCapital="false" dtype="String"/>
                    </td>
                    <td>
                        <input type="button" value="查询" class="btn_Search" onclick="javascript:search('projectGrid','projectForm');"/>&nbsp;
                        <%--<a href="javascript:void(0);" onclick="toggleDiv('advanced_condition', '0')">高级查询</a>--%>
                    </td>
                </tr>
            </table>
            <div style="display: none;height:30px" id="advanced_condition">

            </div>
        </form>
    </div>
    <%--</div>--%>
    <table id="projectGrid"></table>
    <div id="pageProjectGrid"></div>
    <div id="projectWindow"></div>
</div>
</body>
</html>